package com.wangsh.forward.web.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.wangsh.webforward.common.servlet.BaseServlet;
import com.wangsh.webforward.common.util.ConstatFinalUtil;

/**
 * 用户模块的Servlet
 * @author TeaBig
 */
public class UsersHeadServlet extends BaseServlet
{
	private static final long serialVersionUID = 1L;
	
	/**
	 * 初始化对象
	 * @throws ServletException
	 */
	public void initObject()
	{
		
	}

	/**
	 * Servlet的核心方法,不管是Post还是get都要执行此方法
	 */
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException
	{
		super.service(request, response);
		/* 接收一个method参数 */
		String method = request.getParameter("method");
		if ("main".equalsIgnoreCase(method))
		{
			this.main(request, response);
		} 
	}

	/**
	 * 登陆后的首页
	 * @param request
	 * @param response
	 * @throws IOException 
	 * @throws ServletException 
	 */
	private void main(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
	{
		ConstatFinalUtil.SYS_LOGGER.info("==main==");
		String url = "/WEB-INF/jsp/head/users/main.jsp" ;
		request.getRequestDispatcher(url).forward(request, response);
	}
}
